home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 026a / apndbar.zip / APNDBAR.UDF
Text File  |  1991-07-04  |  2KB  |  55 lines

  1. From UserID Jcoc on the ATBBS.  07/01/91.
  2. Spun off of an original idea from 'Hman' on the ATBBS.
  3. Do your own testing.  No guarantees are made.
  4.  
  5. ApndBar() UDF displays a horizontal status bar during APPEND.
  6.  
  7. The bar will 'grow' across the screen as the APPEND progresses.
  8. Placates nervous users by providing something moving on the screen.
  9. Helps avoid 3 finger salutes (Ctrl+Alt+Del) in the middle of a long
  10. operation when there's no screen 'action'.
  11. The idea can be adapted to operations other than APPEND.
  12. Note that an APPEND will take longer using ApndBar().
  13. Example code:
  14. set cursor off
  15. clear
  16. use <database>
  17. public BarRow,BarStart,BarPos,BarLen,StartCnt,BarCount
  18. do ApndBox  && create box frame, set memvars
  19. set dbtrap off
  20. append from <filename> for ApndBar()
  21. set dbtrap on
  22. release BarRow,BarStart,BarPos,BarLen,StartCnt,BarCount
  23. use
  24. clear
  25. set cursor on
  26.  
  27. FUNCTION ApndBar  && displays a horizontal status bar
  28.   BarCount=BarCount-1
  29.   if BarCount>0
  30.     return .t.
  31.   else
  32.     BarCount=StartCnt
  33.   endif
  34.   if BarPos>=BarLen
  35.     BarPos=BarStart
  36.     @ BarRow,BarPos say replicate('▒',BarLen-BarStart) color w/b
  37.     @ BarRow,BarPos say chr(178) color bg+/b
  38.   else
  39.     @ BarRow,BarPos say chr(178) color bg+/b
  40.     BarPos=BarPos+1
  41.   endif
  42. RETURN .t.
  43.  
  44. PROCEDURE ApndBox  && sets up box for horizontal status bar
  45.   BarRow=12
  46.   store 21 to BarStart,BarPos
  47.   BarLen=21+39  && bar starting position + inside width of box
  48.   store 20 to StartCnt,BarCount  && increments bar every 20 records
  49.   @  9,20 fill to 13,60 color b/b
  50.   @  9,20 to 13,60 double color w/b
  51.   @ 11,21 to 11,59 color w/b
  52.   @ 10,33 say 'Appending data' color w+/b
  53.   @ 12,21 say replicate('▒',39) color w/b
  54. RETURN  && procedure ApndBox
  55.